package com.neofinance.reactdemo

import org.springframework.boot.actuate.endpoint.annotation.Endpoint
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation
import org.springframework.boot.actuate.endpoint.annotation.Selector
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation

/**
 * Created by Michael Chen on 2017-8-22.
 */
@Endpoint(id = "ktpoint")
class MyKtPoint(var pointName: String) {

    @ReadOperation
    fun getPointName(): KtApiResponse<KtPoint> {
        return KtApiResponse(1, "获取PointName属性值", KtPoint(this.pointName))
    }

    @WriteOperation
    fun changePointName(@Selector name: String): KtApiResponse<String> {
        this.pointName = name
        return KtApiResponse(1, "修改PointName属性", "成功")
    }

}

data class KtPoint(val pointName: String)

data class KtApiResponse<T>(val responseCode: Int, val action: String, val result: T)
